Skip to content

Modularize MCP server by implementing tool definitions, stateless req…#7598

Merged
cstns merged 8 commits into
7426_mcp-scaffoldingfrom
7429_mcp-endpoint-handler
Jul 1, 2026
Merged

Modularize MCP server by implementing tool definitions, stateless req…#7598
cstns merged 8 commits into
7426_mcp-scaffoldingfrom
7429_mcp-endpoint-handler

Conversation

@cstns

@cstns cstns commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Description

Fills in the MCP server route shell from #7426 with the actual endpoint handler. External AI agents can now connect to POST /api/v1/mcp and get real MCP protocol responses.

  • Stateless Streamable HTTP: fresh McpServer and transport per request, no sessions, cleanup after each request
  • Auth token forwarded to existing routes via app.inject(), so all middleware, validation, and RBAC runs as-is
  • Tool registration framework that auto-discovers tool files from a tools/ directory
  • Stub scope check ready for scoped PATs (Add PAT (Personal Acces Tokens) scopes #7411)
  • Ships with two team tools (list-teams, get-team) to prove the plumbing end-to-end
  • formatResponse helper converts inject responses to MCP CallToolResult, including error propagation
  • Polyfill for socket.destroySoon to handle Fastify's mock sockets in test/inject path

Builds on #7426. Tool definitions for the remaining domains (applications, instances, snapshots, devices, catalog, navigation) are tracked in #7430.

Related Issue(s)

closes #7429

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production
  • Link to Changelog Entry PR, or note why one is not needed.

Labels

  • Includes a DB migration? -> add the area:migration label

@cstns cstns self-assigned this Jun 23, 2026
@cstns cstns linked an issue Jun 23, 2026 that may be closed by this pull request
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.11321% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 76.37%. Comparing base (484652e) to head (114f307).

Files with missing lines Patch % Lines
forge/ee/lib/mcp/toolLoader.js 96.29% 1 Missing ⚠️
Additional details and impacted files
@@                   Coverage Diff                    @@
##           7426_mcp-scaffolding    #7598      +/-   ##
========================================================
+ Coverage                 76.31%   76.37%   +0.05%     
========================================================
  Files                       416      418       +2     
  Lines                     22184    22236      +52     
  Branches                   5873     5877       +4     
========================================================
+ Hits                      16930    16982      +52     
  Misses                     5254     5254              
Flag Coverage Δ
backend 76.37% <98.11%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread forge/ee/routes/mcp/server.js Outdated
*/
app.post('/', async (request, reply) => {
reply.code(501).send({ code: 'not_implemented', error: 'MCP endpoint not yet implemented' })
const server = new McpServer(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will either disable (return 405's) or completely remove the http endpoints implemented here as 3rd party access is not a priority for the time being

Co-authored-by: Steve-Mcl <sdmclaughlin@gmail.com>
Co-authored-by: Stephen McLaughlin <44235289+Steve-Mcl@users.noreply.github.com>
Co-authored-by: Andrea Palmieri <76187074+andypalmi@users.noreply.github.com>
Co-authored-by: andypalmi <andrea@flowfuse.com>
@cstns cstns merged commit adcafae into 7426_mcp-scaffolding Jul 1, 2026
@cstns cstns deleted the 7429_mcp-endpoint-handler branch July 1, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP Endpoint Handler

2 participants